<% extends './sale/weui_base.html' %>
<% block title %>打包单<% endblock %>
<% block body %>
<script>
  var package_row = ${package_row|tojson|safe}
</script>
<div id="product_package">

    <el-alert v-if="pack_form.error" :title="pack_form.error_message" type="error" :closable="false"></el-alert>
    <el-form ref="pack_form" :model="pack_form" label-width="80px" size="mini" v-if="!pack_form.error">
        <el-form-item label="主要信息" size="mini" inline>
            <el-tag>打包单号： {{pack_form.name}}</el-tag>
            <el-tag>对应销售订单：{{pack_form.so_id}}</el-tag>
        </el-form-item>
        <el-form-item label="其他信息" size="mini" inline>
            <el-tag type="info" v-show="pack_form.start_datetime">开始时间:{{pack_form.start_datetime || ''}}</el-tag>
            <el-tag type="info" v-show="pack_form.end_datetime">结束时间:{{pack_form.end_datetime || ''}}</el-tag>
            <el-tag type="info" v-show="pack_form.user_id">包货负责人:{{pack_form.user_id || ''}}</el-tag>
            <el-tag type="info" v-show="pack_form.person_qty">包货人数:{{pack_form.person_qty || ''}}</el-tag>
            <el-tag type="info" v-show="pack_form.package_qty">包货份数:{{pack_form.package_qty || ''}}</el-tag>
            <el-tag>套装名称：{{pack_form.product_name}}</el-tag>
        </el-form-item>
        <el-table :data="pack_form.product_package_line" border stripe>
            <el-table-column
                    label="产品"
                    prop="product_name">
            </el-table-column>
            <el-table-column
                    label="数量"
                    width="50"
                    prop="product_qty">
            </el-table-column>
        </el-table>
        <el-form-item label="主要备注" size="mini" style="margin-left:0px;width:110px;margin-top:20px;">
            <el-input v-model="pack_form.note || ''" :disabled="true" type="textarea"
                      style="width: 220px; margin-left:30px;"
            ></el-input>
        </el-form-item>
        <el-form-item label="包货开始日期" size="mini" label-width="110px" inline v-show="!pack_form.start_datetime">
            <el-date-picker
                    :clearable="true"
                    v-model="start_datetime"
                    type="date"
                    :disabled="pack_form.uid!=pack_form.user_id && pack_form.user_id!=''"
                    :value-format="'yyyy-MM-dd'"
                    placeholder="包货开始日期"></el-date-picker>
        </el-form-item>
        <el-form-item label="包货结束日期" size="mini" label-width="110px" inline v-show="!pack_form.end_datetime">
            <el-date-picker
                    :clearable="true"
                    v-model="end_datetime"
                    type="date"
                    :disabled="pack_form.uid!=pack_form.user_id && pack_form.user_id!=''"
                    :value-format="'yyyy-MM-dd'"
                    placeholder="包货结束日期"></el-date-picker>
        </el-form-item>
        <el-form-item label="包货人数  " size="mini" style="margin-left:0px; width:110px" inline
                      v-show="!pack_form.person_qty">
            <el-input-number v-model="person_qty" :min="1" style="width: 220px; margin-left:30px;"
                              :disabled="pack_form.uid!=pack_form.user_id && pack_form.user_id!=''"
                             label="包货人数"></el-input-number>
        </el-form-item>
        <el-form-item label="操作信息" style="width:110px;margin-left:0px;" v-show="!pack_form.is_done"
                      >
            <el-button type="primary" @click="get_pack_task(pack_form.id)"
                       :disabled="pack_form.uid!=pack_form.user_id && pack_form.user_id!=''"
                       v-show="!pack_form.person_qty || !pack_form.end_datetime || !pack_form.start_datetime || !pack_form.user_id"
                       style="width: 220px; margin-left:30px;">{{button_message}}
            </el-button>
            <el-button type="primary" @click="pack_done(pack_form.id)"
                        :disabled="pack_form.uid!=pack_form.user_id  && pack_form.user_id!=''"
                       v-show="pack_form.person_qty && pack_form.end_datetime && pack_form.start_datetime && pack_form.user_id"
                       style="width: 220px; margin-left:30px;">包货完成
            </el-button>
        </el-form-item>
    </el-form>
</div>

<script src="/dftg_weixin/static/src/js/pack/pack.js?v0.33"></script>
<% endblock %>
